/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * InterfaceFuncionario.java
 *
 * Created on 04/07/2010, 15:54:44
 */

package imobiliaria.gui;

import imobiliaria.controladores.*;
import imobiliaria.entidades.*;

/**
 *
 * @author Thiago Ferreira
 */
public class InterfaceFuncionario extends javax.swing.JFrame {
    private String nomeFunc;

    /** Creates new form InterfaceFuncionario */
    public InterfaceFuncionario(String nomeFunc) {
        this.nomeFunc = nomeFunc;
        initComponents();
        jLabel1.setText(nomeFunc);
        setLocationRelativeTo(null);
        Sistema sis = new Sistema();
	try {
	    sis.atualizaDados();
	} catch (Exception e) {
	    System.out.println("Erro: " + e.getMessage());
	}
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        JL_Ola = new javax.swing.JLabel();
        JB_Cliente = new javax.swing.JButton();
        JB_Imovel = new javax.swing.JButton();
        JB_Aluguel = new javax.swing.JButton();
        JB_Pedido = new javax.swing.JButton();
        JB_VerDados = new javax.swing.JButton();
        JL_Logo = new javax.swing.JLabel();
        JB_Voltar = new javax.swing.JButton();
        JL_Option = new javax.swing.JLabel();
        JL_BoasVindas = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Bem-vindo funcionário");
        setResizable(false);

        JL_Ola.setFont(new java.awt.Font("Arial", 0, 14));
        JL_Ola.setText("Olá,");

        JB_Cliente.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imobiliaria/images/addIcon.png"))); // NOI18N
        JB_Cliente.setText("Clientes");
        JB_Cliente.setToolTipText("");
        JB_Cliente.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseExited(java.awt.event.MouseEvent evt) {
                JB_ClienteMouseExited(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                JB_ClienteMouseEntered(evt);
            }
        });
        JB_Cliente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                JB_ClienteActionPerformed(evt);
            }
        });

        JB_Imovel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imobiliaria/images/homeIcon.png"))); // NOI18N
        JB_Imovel.setText("Imóveis");
        JB_Imovel.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseExited(java.awt.event.MouseEvent evt) {
                JB_ImovelMouseExited(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                JB_ImovelMouseEntered(evt);
            }
        });
        JB_Imovel.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                JB_ImovelActionPerformed(evt);
            }
        });

        JB_Aluguel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imobiliaria/images/noteIcon.png"))); // NOI18N
        JB_Aluguel.setText("Aluguéis");
        JB_Aluguel.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseExited(java.awt.event.MouseEvent evt) {
                JB_AluguelMouseExited(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                JB_AluguelMouseEntered(evt);
            }
        });
        JB_Aluguel.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                JB_AluguelActionPerformed(evt);
            }
        });

        JB_Pedido.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imobiliaria/images/pedidoIcon.png"))); // NOI18N
        JB_Pedido.setText("Pedidos");
        JB_Pedido.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseExited(java.awt.event.MouseEvent evt) {
                JB_PedidoMouseExited(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                JB_PedidoMouseEntered(evt);
            }
        });
        JB_Pedido.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                JB_PedidoActionPerformed(evt);
            }
        });

        JB_VerDados.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imobiliaria/images/info2icon.png"))); // NOI18N
        JB_VerDados.setText("Seus dados");
        JB_VerDados.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseExited(java.awt.event.MouseEvent evt) {
                JB_VerDadosMouseExited(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                JB_VerDadosMouseEntered(evt);
            }
        });
        JB_VerDados.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                JB_VerDadosActionPerformed(evt);
            }
        });

        JL_Logo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imobiliaria/images/iMobLogo.png"))); // NOI18N

        JB_Voltar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imobiliaria/images/backIcon.png"))); // NOI18N
        JB_Voltar.setText("Voltar");
        JB_Voltar.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseExited(java.awt.event.MouseEvent evt) {
                JB_VoltarMouseExited(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                JB_VoltarMouseEntered(evt);
            }
        });
        JB_Voltar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                JB_VoltarActionPerformed(evt);
            }
        });

        JL_Option.setFont(new java.awt.Font("DejaVu Sans", 0, 14));
        JL_Option.setText("Escolha uma das opções.");

        JL_BoasVindas.setText("Bem-vindo as opções de funcionário");

        jLabel1.setText("Nome do Funcionario");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(12, 12, 12)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(JB_Cliente, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(JB_Imovel, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(90, 90, 90)
                                .addComponent(JL_Option))
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                .addComponent(JB_VerDados, javax.swing.GroupLayout.PREFERRED_SIZE, 145, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGroup(layout.createSequentialGroup()
                                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(JB_Aluguel, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addComponent(JB_Pedido, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addComponent(JB_Voltar))
                                    .addGap(184, 184, 184)
                                    .addComponent(JL_Logo)))))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(10, 10, 10)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(JL_Ola)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(jLabel1))
                            .addGroup(layout.createSequentialGroup()
                                .addGap(12, 12, 12)
                                .addComponent(JL_BoasVindas, javax.swing.GroupLayout.PREFERRED_SIZE, 265, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                .addContainerGap(21, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(20, 20, 20)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(JL_Ola)
                            .addComponent(jLabel1))
                        .addGap(6, 6, 6)
                        .addComponent(JL_BoasVindas))
                    .addComponent(JB_VerDados))
                .addGap(34, 34, 34)
                .addComponent(JB_Cliente)
                .addGap(21, 21, 21)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(9, 9, 9)
                        .addComponent(JB_Imovel, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(JL_Option))
                .addGap(21, 21, 21)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(JB_Aluguel, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(JB_Pedido, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(JB_Voltar))
                    .addComponent(JL_Logo, javax.swing.GroupLayout.PREFERRED_SIZE, 190, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(12, 12, 12))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void JB_ClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_JB_ClienteActionPerformed
        new InterfaceOpClientes().setVisible(true);

    }//GEN-LAST:event_JB_ClienteActionPerformed

    private void JB_ImovelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_JB_ImovelActionPerformed
        new InterfaceOpImovel().setVisible(true);
    }//GEN-LAST:event_JB_ImovelActionPerformed

    private void JB_AluguelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_JB_AluguelActionPerformed
        new InterfaceListagem("Alugueis", "Listagem de Aluguéis", ControladorAlugueis.getInstance().listaAlugueis()).setVisible(true);
    }//GEN-LAST:event_JB_AluguelActionPerformed

    private void JB_PedidoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_JB_PedidoActionPerformed
        // Opcoes de pedido
        new InterfaceListagem("Pedidos", "Listagem de Pedidos", ControladorPedidos.getInstance()
                .listagemDePedido()).setVisible(true);
    }//GEN-LAST:event_JB_PedidoActionPerformed

    private void JB_VoltarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_JB_VoltarActionPerformed
        // Voltar a telaprincipal
        new TelaPrincipal().setVisible(true);
        dispose();
    }//GEN-LAST:event_JB_VoltarActionPerformed

    private void JB_ClienteMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_JB_ClienteMouseEntered
       JL_Option.setForeground(new java.awt.Color(255, 0, 0));
       JL_Option.setText("Clique para abrir as opções de cliente");
    }//GEN-LAST:event_JB_ClienteMouseEntered

    private void JB_ClienteMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_JB_ClienteMouseExited
       JL_Option.setForeground(new java.awt.Color(0,0,0));
       JL_Option.setText(TEXTOCENTRAL);
    }//GEN-LAST:event_JB_ClienteMouseExited

    private void JB_ImovelMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_JB_ImovelMouseEntered
       JL_Option.setForeground(new java.awt.Color(255, 0, 0));
       JL_Option.setText("Clique para abrir as opções de imóvel");
    }//GEN-LAST:event_JB_ImovelMouseEntered

    private void JB_ImovelMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_JB_ImovelMouseExited
       JL_Option.setForeground(new java.awt.Color(0,0,0));
       JL_Option.setText(TEXTOCENTRAL);
    }//GEN-LAST:event_JB_ImovelMouseExited

    private void JB_AluguelMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_JB_AluguelMouseEntered
       JL_Option.setForeground(new java.awt.Color(255, 0, 0));
       JL_Option.setText("Clique para abrir as opções de aluguel");
    }//GEN-LAST:event_JB_AluguelMouseEntered

    private void JB_AluguelMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_JB_AluguelMouseExited
       JL_Option.setForeground(new java.awt.Color(0,0,0));
       JL_Option.setText(TEXTOCENTRAL);
    }//GEN-LAST:event_JB_AluguelMouseExited

    private void JB_PedidoMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_JB_PedidoMouseEntered
       JL_Option.setForeground(new java.awt.Color(255, 0, 0));
       JL_Option.setText("Clique para abrir a listagem de pedidos");
    }//GEN-LAST:event_JB_PedidoMouseEntered

    private void JB_PedidoMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_JB_PedidoMouseExited
       JL_Option.setForeground(new java.awt.Color(0,0,0));
       JL_Option.setText(TEXTOCENTRAL);
    }//GEN-LAST:event_JB_PedidoMouseExited

    private void JB_VoltarMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_JB_VoltarMouseEntered
       JL_Option.setForeground(new java.awt.Color(255, 0, 0));
       JL_Option.setText("Clique para voltar a tela principal");
    }//GEN-LAST:event_JB_VoltarMouseEntered

    private void JB_VoltarMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_JB_VoltarMouseExited
       JL_Option.setForeground(new java.awt.Color(0,0,0));
       JL_Option.setText(TEXTOCENTRAL);
    }//GEN-LAST:event_JB_VoltarMouseExited

    private void JB_VerDadosMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_JB_VerDadosMouseEntered
       JL_Option.setForeground(new java.awt.Color(255, 0, 0));
       JL_Option.setText("Clique para verificar seus dados");
    }//GEN-LAST:event_JB_VerDadosMouseEntered

    private void JB_VerDadosMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_JB_VerDadosMouseExited
       JL_Option.setForeground(new java.awt.Color(0,0,0));
       JL_Option.setText(TEXTOCENTRAL);
    }//GEN-LAST:event_JB_VerDadosMouseExited

    private void JB_VerDadosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_JB_VerDadosActionPerformed
        Funcionario func = ControladorFuncionario.getInstance().getFuncionarioPorNome(nomeFunc);
        new InterfaceDadosFuncionario(func).setVisible(true);
    }//GEN-LAST:event_JB_VerDadosActionPerformed

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new InterfaceFuncionario("Funcionario default").setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton JB_Aluguel;
    private javax.swing.JButton JB_Cliente;
    private javax.swing.JButton JB_Imovel;
    private javax.swing.JButton JB_Pedido;
    private javax.swing.JButton JB_VerDados;
    private javax.swing.JButton JB_Voltar;
    private javax.swing.JLabel JL_BoasVindas;
    private javax.swing.JLabel JL_Logo;
    private javax.swing.JLabel JL_Ola;
    private javax.swing.JLabel JL_Option;
    private javax.swing.JLabel jLabel1;
    // End of variables declaration//GEN-END:variables
    private String TEXTOCENTRAL = "Escolha uma das opções.";
}
